<!--
    (c) 2007, Stephane Alnet
    
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 3
    of the License, or (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
<!--
    Note: the idea with the extra parameters is that every time a value is changed
    (e.g. fe_media) then (Dojo?) will look for all the objects that have that
    parameter, and hide^Wdisable them if the value for the parameter does not match the
    selected value.
-->

<!-- for each port on the card -->
<div>
    <fieldset>
        <legend>Port <TMPL_VAR NAME="port"></legend>
        <!-- Uses CPU <TMPL_VAR NAME="cpu"> -->
        <p>
            <label for="<TMPL_VAR NAME="port_id">_fe_media">Media</label>
            <select name="<TMPL_VAR NAME="port_id">_fe_media" id="<TMPL_VAR NAME="port_id">_fe_media" class="trigger">
                <option value="Unused">Unused</option>
                <option value="T1">T1 (24 channels)</option>
                <option value="E1">E1 (32 channels)</option>
            </select>
        </p>

        <div <TMPL_VAR NAME="port_id">_fe_media="E1 T1">

            <p>
                <label for="<TMPL_VAR NAME="port_id">_fe_lcode">Line coding</label>
                <select name="<TMPL_VAR NAME="port_id">_fe_lcode" id="<TMPL_VAR NAME="port_id">_fe_lcode">
                    <option value="b8zs" <TMPL_VAR NAME="port_id">_fe_media="T1"   is_default="true">B8ZS</option>
                    <option value="hdb3" <TMPL_VAR NAME="port_id">_fe_media="E1"   is_default="true">HDB3</option>
                    <option value="ami"  <TMPL_VAR NAME="port_id">_fe_media="T1 E1">AMI</option>
                </select>
            </p>
            <p>
                <label for="<TMPL_VAR NAME="port_id">_fe_frame">Framing</label>
                <select name="<TMPL_VAR NAME="port_id">_fe_frame" id="<TMPL_VAR NAME="port_id">_fe_frame">
                    <option value="esf"     <TMPL_VAR NAME="port_id">_fe_media="T1" is_default="true">ESF</option>
                    <option value="d4"      <TMPL_VAR NAME="port_id">_fe_media="T1"                  >D4</option>
                    <option value="crc4"    <TMPL_VAR NAME="port_id">_fe_media="E1" is_default="true">CRC4 (SF)</option><!-- CCS + CRC4 -->
                    <option value="ncrc4"   <TMPL_VAR NAME="port_id">_fe_media="E1"                  >non-CRC4</option><!-- CCS -->
                </select>
            </p>
            <!-- <label>DS0 Mapping</label> -->    

            <!-- <label>Line buildout</label> -->
            <p>
                <label for="<TMPL_VAR NAME="port_id">_fe_clock" <TMPL_VAR NAME="port_id">_fe_media="T1 E1">Clock source</label>
                <select name="<TMPL_VAR NAME="port_id">_fe_clock" id="<TMPL_VAR NAME="port_id">_fe_clock" <TMPL_VAR NAME="port_id">_fe_media="T1 E1"  class="trigger">
                    <option value="normal" is_default="true">Normal / line</option>
                    <option value="master"  <TMPL_VAR NAME="port_id">_device_has_normal_clock="TRUE">Master / internal</option>
                </select>
            </p>
            <p>
                <label for="<TMPL_VAR NAME="port_id">_te_ref_clock" <TMPL_VAR NAME="port_id">_fe_clock="master" <TMPL_VAR NAME="port_id">_fe_media="T1 E1">Reference clock</label>
                <select name="<TMPL_VAR NAME="port_id">_te_ref_clock" id="<TMPL_VAR NAME="port_id">_te_ref_clock" <TMPL_VAR NAME="port_id">_fe_clock="master" <TMPL_VAR NAME="port_id">_fe_media="T1 E1">
                    <option value="0">Free run (Use internal oscillator on card)</option>
                    <!-- Build a list of available ports -->
                    <option value="1" <TMPL_VAR NAME="port_id">_fe_media="E1 T1">Use Port 1</option>
                </select>
            </p>

            <!-- For now only support one type of use per port -->
            <!-- and don't worry about NFAS -->
            <TMPL_LOOP NAME="ts_groups">
                <TMPL_INCLUDE NAME="signaling.html">
            </TMPL_LOOP>
        </div> <!-- Port is used -->

    </fieldset>

</div>
